/*
 * Copyright 2022 The Open Islands Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.openislands.oi.scheduling;

import org.springframework.beans.factory.annotation.Autowired;

// 创建枚举实现 IErrorCode里面的方法
public enum DAGErrorEnums implements IErrorCode {
    ROLE_MAPPING_EMPTY("098", "role mapping empty"),
    ROLE_ID_DUPLICATE("099", "role id duplicate"),
    OPERATOR_LIST_EMPTY("100", "operator list empty"),
    OPERATOR_MODULE_NOT_EXISTS("101", "operator module not exists"),
    OPERATOR_NAME_DUPLICATE("102", "operator name duplicate"),
    OPERATOR_NAME_NOT_EXISTS("103", "operator name not exists"),
    OPERATOR_NAME_INVALID("104", "operator name is invalid"),
    OPERATOR_INPUT_NOT_EXISTS("105", "operator input not exists"),
    OPERATOR_OUTPUT_NOT_EXISTS("106", "operator output not exists"),
    OPERATOR_OUTPUT_ALL_NULL("107", "operator output all null"),
    OPERATOR_OUTPUT_DATA_TYPE_ERROR("108", "operator output data type error"),
    OPERATOR_OUTPUT_MODEL_TYPE_ERROR("109", "operator output model type error"),
    OPERATOR_INPUT_DATA_FORMAT_ERROR("110", "operator input data format {name}.{dataX}"),
    OPERATOR_INPUT_MODEL_FORMAT_ERROR("111", "operator model data format {name}.{modelX}"),
    OPERATOR_INPUT_PREV_NAME_DISCONNECT("112", "operator input prev name disconnect"),
    OPERATOR_INPUT_PREV_DATA_DISCONNECT("113", "operator input prev data disconnect"),
    OPERATOR_INPUT_PREV_MODEL_DISCONNECT("114", "operator input prev model disconnect"),
    OVERWRITE_RESOURCE_FIELD_EMPTY("200", "overwrite resource field empty"),
    OVERWRITE_OPERATOR_LIST_EMPTY("201", "overwrite operator list empty"),
    OVERWRITE_OPERATOR_NAME_NOT_MATCH("202", "overwrite operator name not match"),
    OVERWRITE_OPERATOR_MODULE_NOT_MATCH("203", "overwrite operator module not match"),
    OVERWRITE_OPERATOR_INPUT_NOT_MATCH("204", "overwrite operator input not match"),
    OVERWRITE_OPERATOR_OUTPUT_NOT_MATCH("205", "overwrite operator output not match"),

    ;


    @Autowired
    private String code;
    @Autowired
    private String message;

    private DAGErrorEnums(String code, String message) {
        this.code = code;
        this.message = message;
    }

    private DAGErrorEnums(IErrorCode errorCode) {
        this.code = errorCode.getCode();
        this.message = errorCode.getMessage();
    }

    @Override
    public String getCode() {
        return code;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
